package com.nce.entity;

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 *关键字
 * 
 * @author GT
 */
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "vp")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Vp extends IdEntity{
	
//	CREATE TABLE `vp` (
//			  `id` bigint(20) NOT NULL AUTO_INCREMENT,
//			  `qqid` varchar(50) DEFAULT NULL COMMENT 'QQ账号',
//			  `username` varchar(50) DEFAULT NULL COMMENT '姓名',
//			  `phone` varchar(50) DEFAULT NULL COMMENT '电话',
//			  `email` varchar(50) DEFAULT NULL,
//			  `address` varchar(255) DEFAULT NULL COMMENT '地址',
//			  `memo` varchar(255) DEFAULT NULL COMMENT '备注',
//			  `ctime` datetime DEFAULT NULL COMMENT '创建日期',
//			  `del` tinyint(1) DEFAULT NULL COMMENT '是否删除1为删除',
//			  `dtime` datetime DEFAULT NULL COMMENT '删除时间',
//			  PRIMARY KEY (`id`)
//			) ENGINE=InnoDB DEFAULT CHARSET=utf8
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -1302956545470002690L;
	private String qqid="";
	private Date ctime;	
	private String username="";
	private String phone ="";
	private String email ="";
	private String address ="";
	private String memo = "";
	private Date dtime;
	private boolean del;
	public String getQqid() {
		return qqid;
	}
	public void setQqid(String qqid) {
		this.qqid = qqid;
	}
	public Date getCtime() {
		return ctime;
	}
	public void setCtime(Date ctime) {
		this.ctime = ctime;
	}
	@Column(name="realname")
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	public Date getDtime() {
		return dtime;
	}
	public void setDtime(Date dtime) {
		this.dtime = dtime;
	}
	public boolean isDel() {
		return del;
	}
	public void setDel(boolean del) {
		this.del = del;
	}
	@Override
	public String toString() {
		return "Vp [address=" + address + ", ctime=" + ctime + ", del=" + del
				+ ", dtime=" + dtime + ", email=" + email + ", memo=" + memo
				+ ", phone=" + phone + ", qqid=" + qqid + ", username="
				+ username + ", id=" + id + "]";
	}
	public String formatToTxt() {
		StringBuffer sb = new StringBuffer();
//		Format formatter = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
//	    String dateStr = formatter.format(ctime);
		sb.append(qqid).append(",").append(username).append(",").append(phone).append(",").append(email).append(",").append(address).append(",").append(memo).append(",").append("\r\n");
		return sb.toString();
	}

	
	
	


}
